package com.liuweiheng.cloud.entity;

import com.liuweiheng.base.annotation.PhoneNumber;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Value;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;


/**
 * @author lwh
 * @since 2021/5/28
 */
@ApiModel("用户实体类")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Builder
public class User implements Serializable {

    @ApiModelProperty("唯一标识")
    private Integer id;

    @ApiModelProperty("用户名")
    @Size(max = 255, min = 12, message = "用户名长度应在12-255之间")
    @NotNull(message = "用户名不能为空")
    // @Pattern(regexp = "^zhangsan&|^lisi&", message = "用户名只能填zhangsan或者lisi")
    private String username;

    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("盐")
    private String salt;

    @ApiModelProperty("状态,0冻结,1激活")
    private Integer state;

    @ApiModelProperty("手机号")
    @PhoneNumber
    private String phoneNumber;

    private boolean isActive;
}
